aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/routes/matches/[match_id].svelte
blob: 7c1507caf09df74ef254bd79d7701cba005ccd48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script lang="ts" context="module">
  import { ApiClient } from "$lib/api_client";
  export async function load({ params, fetch }) {
    try {
      const matchId = params["match_id"];
      const apiClient = new ApiClient(fetch);
      const [matchData, matchLog] = await Promise.all([
        apiClient.get(`/api/matches/${matchId}`),
        apiClient.getText(`/api/matches/${matchId}/log`),
      ]);
      return {
        props: {
          matchData: matchData,
          matchLog: matchLog,
        },
      };
    } catch (error) {
      return {
        status: error.status,
        error: error,
      };
    }
  }
</script>

<script lang="ts">
  import Visualizer from "$lib/components/Visualizer.svelte";
  export let matchLog: string;
  export let matchData: object;
</script>

<div class="container">
  <Visualizer {matchLog} {matchData} />
</div>

<style lang="scss">
  .container {
    display: flex;
    // these are needed for making the visualizer fill the screen.
    min-height: 0;
    flex-grow: 1;
    overflow: hidden;
  }
</style>